Skip to content

feat(electrum): add blockchain.scripthash.get_mempool#226

Merged
EddieHouston merged 1 commit into
Blockstream:new-indexfrom
EddieHouston:feat/scripthash-get-mempool
Jul 1, 2026
Merged

feat(electrum): add blockchain.scripthash.get_mempool#226
EddieHouston merged 1 commit into
Blockstream:new-indexfrom
EddieHouston:feat/scripthash-get-mempool

Conversation

@EddieHouston

@EddieHouston EddieHouston commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements blockchain.scripthash.get_mempool, part of the Electrum protocol (a method that has existed since 1.1; electrs advertises 1.4). Previously a client calling this method received an unknown-method error (EOF), which is confusing given the advertised protocol version.

The new handler returns the unconfirmed history of a script hash as a list of {tx_hash, height, fee}, where:

  • height is 0 when all of the transaction's inputs are confirmed, and
  • height is -1 when the transaction has unconfirmed parents,

per the spec. It performs a mempool-only lookup and enforces the same txs_limit / TooPopular guard already used by get_history, reusing the existing GetHistoryResult serialization so fee is included.

On ordering: at protocol 1.4 the result order is undefined, so this returns results in mempool order. Protocol 1.6 tightens this to a canonical (-height, tx_hash) order; that's tracked with the broader 1.6 work in #172.

Test plan

Adds test_electrum_scripthash_get_mempool (tests/electrum.rs), which verifies:

  • an empty result for a script hash with no mempool history,
  • a single entry with height: 0 and a present fee after an unconfirmed funding tx, and
  • the entry disappearing from the result once the tx is confirmed.

Closes #120

…lectrs

  Implement the get_mempool method from the Electrum 1.4 protocol (which
  electrs already advertises). Returns a script hash's unconfirmed history
  as {tx_hash, height, fee}, with height 0 when all inputs are confirmed
  and -1 when there are unconfirmed parents. Mempool-only lookup, reusing
  the get_history txs_limit / TooPopular guard.

  Closes Blockstream#120
@EddieHouston EddieHouston merged commit 1c8d7f8 into Blockstream:new-index Jul 1, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for the blockchain.scripthash.get_mempool endpoint

2 participants